package com.example.steveaoblogdemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.steveaoblogdemo.entity.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
    @Insert("insert into comment (id,a_id,c_name,content,create_time,parent_id,reply) values " +
            "(#{id},#{aId},#{cName},#{content},#{createTime},#{parentId},#{reply})")
    int addComment(Integer id, Integer aId, String cName, String content, String createTime,Integer parentId,String reply);

    @Select("select id, a_id, c_name, content, create_time, parent_id,reply from comment where a_id=#{aId}")
    List<Comment> search(Integer aId);
}
